#include <stdio.h>
void selectionSort(int arr[], int n) {
	for (int i = 0; i < n - 1; i++) {
		int max_idx = i;
		for (int j = i + 1; j < n; j++) {
			if (arr[j] > arr[max_idx]) {
				max_idx = j;
			}
		}
		int temp = arr[i];
		arr[i] = arr[max_idx];
		arr[max_idx] = temp;
	}
}
int main() {
	int arr[10];
	printf("请输入10个整数：\n");
	for (int i = 0; i < 10; i++) {
		scanf("%d", &arr[i]);
	}
	
	selectionSort(arr, 10);
	
	printf("排序后的结果为：\n");
	for (int i = 0; i < 10; i++) {
		printf("%d ", arr[i]);
	}
	printf("\n");
	
	return 0;
}

/*void yanghui(int row){
	int arr[100][100];
	int i,j;
	for(i=0;i<row;i++){
		for(j=0;j<=i;j++){
			if(j==0||i==j){
				arr[i][j]=1;
			}
			else{
				arr[i][j]=arr[i-1][j-1]+arr[i-1][j];
			}
		}
	}
	for(i=0;i<row;i++){
		for(j=0;j<row-i-1;j++){
			printf(" ");
		}
		for(j=0;j<=i;j++){
			printf("%d ",arr[i][j]);
		}
		printf("\n");
	}
}
int main(){
	int row;
	printf("请输入需要打印多少行");
	scanf("%d",&row);
	yanghui(row);
	return 0;
  }*/
/*int f(int a){
	if(a==1){
		return 1;
	}
	return f(a-1)+a*a*a;
}
int main(){
	int a;
	scanf("%d",&a);
	printf("%d",f(a));
	return 0;
  }*/
/*void bubbleSort(int arr[], int size) {
	int i, j, temp;
	for (i = 0; i < size - 1; i++) {
		int count = 0;
		for (j = 0; j < size - 1 - i; j++) {
			if (arr[j] > arr[j + 1]) {
				temp = arr[j];
				arr[j] = arr[j + 1];
				arr[j + 1] = temp;
				count = 1;
			}
		}
		if (count == 0)
			break;
	}
}

int main() {
	int arr[100];
	int size = 0;
	
	printf("请输入需要排序的数字：\n");
	while (scanf("%d", &arr[size]) != EOF) {
		size++;
		if (size >= 100)
			break;
	}
	
	printf("排序前的数组：\n");
	for (int a = 0; a < size; a++) {
		printf("%d ", arr[a]);
	}
	
	printf("\n排序后的数组：\n");
	bubbleSort(arr, size);
	for (int a = 0; a < size; a++) {
		printf("%d ", arr[a]);
	}
	
	return 0;
  }*/
/*void exchange(int arr[]){
	int max=arr[0];
	int min=arr[9];
	int i,m=9,n=0;
	for(i=1;i<10;i++){
		if(arr[i]>max){
			max=arr[i];
		    n=i;
		}
	}
	for(i=0;i<9;i++){
		if(arr[i]<min){
			min=arr[i];
             m=i;		
		}
	}
	i=arr[n];
	arr[n]=arr[m];
	arr[m]=i;
}
int main(){
	int arr[10],i;
	for(i=0;i<10;i++){
		scanf("%d",&arr[i]);
	}
	printf("\n");
	for(i=0;i<10;i++){
		printf("%d ",arr[i]);
	}
		printf("\n");
	exchange(arr);
	for(i=0;i<10;i++){
		printf("%d ",arr[i]);
	}
	return 0;
  }*/
/*int f(int arr[]){
	int num=0,i,sum;
	for(i=0;i<10;i++){
		num+=arr[i];
	}
	sum=num/10;
	return sum;
}
int main(){
	int arr[10];
	for(int i=0;i<10;i++){
		scanf("%d",&arr[i]);
	}
	printf("%d",f(arr));
	return 0;
  }*/
/*void exchange(int a,int b,int arr[]){
	int c;
	c=a;
	a=b;
	b=c;
	c=arr[0];
	arr[0]=arr[1];
	arr[1]=c;
}
int main(){
	int a,b,arr[2];
	scanf("%d %d %d %d",&a,&b,&arr[0],&arr[1]);
	exchange(a,b,arr);
	printf("%d %d %d %d",a,b,arr[0],arr[1]);
	return 0;
  }*/
/*int f(int a){
	int i,num=1;
	for(i=1;i<=a;i++){num*=i;}
	return num;
}
int main(){
	int n;
	scanf("%d",&n);
	while(n!=0){
		printf("%d\n",f(n));
		scanf("%d",&n);
	}
	return 0;
  }*/
/*void f(int *x,int n){
	int i,sum=1;
	for(i=0;i<n;i++){
		sum*=(*x);
	}
	*x=sum;
}
int main(){
	int x,n;
	scanf("%d %d",&x,&n);
	f(&x,n);
	printf("%d",x);
	return 0;
  }*/
